<script>
{% if is_granted('ROLE_SUPER_ADMIN') %}
$(function(){
	$('#{{ form.university.vars.id }}').closest('div.control-group').css({ 'display': 'none' });
	$('#{{ form.userCategory.vars.id }}').change(function() {
		if ($(this).val() != '' && $(this).val() != {{ userCategoryEnReverse['outsider'] }}) {
			$('#{{ form.university.vars.id }}').closest('div.control-group').css({ 'display': '' });
		} else {
			$('#{{ form.university.vars.id }}').closest('div.control-group').css({ 'display': 'none' });
		}
	});
});
{% endif %}

{% set entity = { 'parent': 'CmUser' } %}
{% set ignore = [ 'university', 'userCategory' ] %}
{% render "AcmeSecurityBundle:JsValidator:jsConstraintsGenerator" with { 'form': form, 'options': { 'entity': entity, 'ignore': ignore } } %}
</script>
<form class="form-horizontal" id="{{ form.vars.id }}" {{ form_enctype(form) }}>
	{{ form_row(form.userCategory) }}
	
	{% if is_granted('ROLE_SUPER_ADMIN') %}
	{{ form_row(form.university) }}
	{% endif %}
	
	{{ form_row(form.username) }}
	{{ form_row(form.email) }}
	
	{{ form_rest(form) }}
</form>	